<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    <%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<link href="${pageContext.request.contextPath}/statics/bootstrap-3.3.5-dist/css/bootstrap.min.css" title="" rel="stylesheet" />
<link title="" href="${pageContext.request.contextPath}/statics/css/style.css" rel="stylesheet" type="text/css"  />
<link title="blue" href="${pageContext.request.contextPath}/statics/css/dermadefault.css" rel="stylesheet" type="text/css"/>
<link title="green" href="${pageContext.request.contextPath}/statics/css/dermagreen.css" rel="stylesheet" type="text/css" disabled="disabled"/>
<link title="orange" href="${pageContext.request.contextPath}/statics/css/dermaorange.css" rel="stylesheet" type="text/css" disabled="disabled"/>
<link href="${pageContext.request.contextPath}/statics/css/templatecss.css" rel="stylesheet" title="" type="text/css" />
<script src="${pageContext.request.contextPath}/statics/script/jquery-1.11.1.min.js" type="text/javascript"></script>
<script src="${pageContext.request.contextPath}/statics/script/jquery.cookie.js" type="text/javascript"></script>
<script src="${pageContext.request.contextPath}/statics/bootstrap-3.3.5-dist/js/bootstrap.min.js" type="text/javascript"></script>
</head>
<body>
	<div class="center-back right-back">
        <div class="container-fluid">
          <div class="info-center">
                    <div class="page-header">
                      <div class="pull-left">
						<h4>更换宿舍</h4>      
					</div>
                    <div class="pull-right">
                     <!-- <button type="button" class="btn btn-mystyle btn-sm">搜索</button>
                         <button type="button" class="btn btn-mystyle btn-sm">返回</button>
                          -->   
                    </div>
                    </div>
                    
                    <script type="text/javascript">
                    	$(function() {
							$("form").submit(function() {
								var floorid=$("#floorid").val();
								if(floorid=="00"){
									$("#message").text("请选择楼区");
									return false;
								}
								var layerid=$("#layerid").val();
								if(layerid=="00"){
									$("#message").text("请选择楼层");
									return false;
								}
								var roomid=$("#roomid").val();
								if(roomid=="00"){
									$("#message").text("请选择房间号");
									return false;
								}
							})
							
						})
                    </script>
                    
                    
				    <div class="search-box row">
                       <div class="col-md-8" style="width: 100%;">
                          <form action="${pageContext.request.contextPath}/users/updatesushe" method="post">
                        	<input type="hidden" name="userid" value="${users.userid}" />
                          <span class="pull-left form-span">姓名: ${users.username}</span>
                           <br /><br />
                          
                             楼区：
                          <select id="floorid" name="floorid"style="width: 10%;height: 33px; border-color: #ccc;border-radius: 5px;">
                          	<option value="00">--请选择--</option>
                          	<c:forEach items="${addlist}" var="add">
                          		<option value="${add.addressid}">${add.name}</option>
                          	</c:forEach>
                          </select><br /><br />
		楼层：
                          <select id="layerid" name="layerid" style="width: 10%;height: 33px; border-color: #ccc;border-radius: 5px;">
                          	<option value="00">--请选择--</option>
                          </select><br /><br />
                          房间：
                          <select id="roomid" name="roomid"  style="width: 10%;height: 33px; border-color: #ccc;border-radius: 5px;">
                          	<option value="00">--请选择--</option>
                          </select><br /><br />
                            <input type="submit" class="btn btn-mystyle btn-sm" value="确认修改"/>
                            </form>
                            <br />
                         	<div class="form-group" id="message" style="color: red;">
                           </div>
                           
                           <div>
                           
                           <script type="text/javascript">
	$(function() {
		$("#floorid").change(function () {
            $("#layerid").empty();
            $("#layerid").append("<option value='00'>--请选择--</option>");

            var op=$(this).val();
            $.get("${pageContext.request.contextPath}/address/queryAddress",
                {"pid":op},function (result) {
                    $.each(result,function (index,address) {
                        $("#layerid").append("<option value='"+address.addressid+"'>"+address.name+"</option>");
                    });
                });
        });
		$("#layerid").change(function () {
            $("#roomid").empty();
            $("#roomid").append("<option value='00'>--请选择--</option>")
            var op=$(this).val();
            $.get("${pageContext.request.contextPath}/address/queryAddress",
                {"pid":op},function (result) {
                    $.each(result,function (index,address) {
                        $("#roomid").append("<option value='"+address.addressid+"'>"+address.name+"</option>");
                    });
                });

        });


	})
</script>
                           
                         
                           </div>
                        
                         
                    </div>
                    <div class="clearfix"></div>
                  
                    </div>
          </div>
        </div>
        </div>
</body>
</html>